(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "PV")
(script 504)


(local
    local0
    local1[4]
    local5

)
(instance gullBlock1 of Cage
    (properties)
)
(instance public {Gull Region} of Rgn
    (properties)

    (method (init)
        (if (not global100)
            (gullBlock1:
                top(65516)
                bottom(55)
                left(65506)
                right(349)
                init()
            )
            Load(rsVIEW 325)
            Load(rsVIEW 326)
            = local0 2
            (if ((<> gGNewPropX 7) and (<> gGNewPropX 40))
                = local5 1
                (while (<= local5 local0)
                    = local1[local5] (send ((Act:new())):
                            x(Random(1 280))
                            y(Random(1 30))
                            xStep(1)
                            yStep(1)
                            cycleSpeed(1)
                            observeBlocks(gullBlock1)
                            setPri(0)
                            setCycle(Fwd)
                            setMotion(Wander 15)
                            view(
                                (if (== gGNewPropX 32)
                                    325
                                )(else
                                    Random(325 326)
                                )
)
                            ignoreHorizon(1)
                            illegalBits(16384)
                            init()
                            yourself()
                        )
                    ++local5
                )
            )
        )
        (super:init())
    )


    (method (handleEvent pEvent)
        (var gInvSaidMe)
        (if ((send pEvent:claimed()))
            return 1
        )
        return 
            (if (== (send pEvent:type()) 128)
                (if (not global100)
                    (if (Said('/gull,gull,bird>'))
                        (if (Said('look'))
                            Print(504 0)
                        )(else
                            (if (Said('converse'))
                                Print(504 1)
                            )(else
                                (if (Said('get,capture'))
                                    Print(504 2)
                                )(else
                                    (if (Said('kiss'))
                                        Print(504 3)
                                    )(else
                                        (if (Said('feed'))
                                            Print(504 4)
                                        )
                                    )
                                )
                            )
                        )
                    )(else
                        (if (Said('deliver/*/gull,gull,bird'))
                            (if (not = gInvSaidMe (send gInv:saidMe()))
                                Print(504 5)
                            )(else
                                (if ((send gEgo:has((send gInv:indexOf(gInvSaidMe)))))
                                    Print(504 6)
                                )(else
                                    proc0_19()
                                )
                            )
                        )(else
                            (if (Said('fling'))
                                (if (not = gInvSaidMe (send gInv:saidMe()))
                                    Print(504 7)
                                )(else
                                    (if ((send gEgo:has((send gInv:indexOf(gInvSaidMe)))))
                                        Print(504 8)
                                    )(else
                                        proc0_19()
                                    )
                                )
                            )
                        )
                    )
                )(else
                    Print(504 9)
                )
            )(else
                0
            )
    )

)
